package com.qianli.cashmama.trade.common.enums;

import java.util.Objects;

/**
 * @Author: wujiapeng
 * @Description: 借款用途
 * @Date: created in 09:54 2018/1/15
 */
public enum UsageOfLoanEnum {
    PERSONAL_DAILY_CONSUMPTION(0, "个人日常消费"),
    DECORATION(1, "装修"),
    TRAVEL(2, "旅游"),
    EDUCATION(3, "教育"),
    MEDICAL_INSURANCE(4, "医疗");

    UsageOfLoanEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private int code;

    private String desc;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static UsageOfLoanEnum getByCode(Integer code){
        UsageOfLoanEnum[] usageOfLoanEnums = UsageOfLoanEnum.values();
        for (UsageOfLoanEnum usageOfLoanEnum : usageOfLoanEnums){
            if (Objects.equals(usageOfLoanEnum.getCode(), code)){
                return usageOfLoanEnum;
            }
        }
        return null;
    }

}
